package fr.emn.nuitinfo.model;

import java.util.List;

import com.google.gson.Gson;
import com.google.gson.annotations.Expose;
import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;

import fr.emn.nuitinfo.model.interfaces.IParticipationChasse;
import fr.emn.nuitinfo.model.interfaces.IUtilisateur;

@Entity
public class Utilisateur implements IUtilisateur {

    /**
     * 
     */
    private static final long          serialVersionUID = -3492485712731211243L;

    private String                     firstName;
    private String                     lastName;
    @Expose
    @Id
    private String                     username;
    @Expose
    private String                     mail;
    private String                     password;
    private List<IParticipationChasse> participations;

    public Utilisateur() {
	ObjectifyService.register(getClass());
    }

    public Utilisateur(String firstName, String lastName, String username,
	    String mail, String password) {
	super();
	this.firstName = firstName;
	this.lastName = lastName;
	this.username = username;
	this.mail = mail;
	this.password = password;
    }

    public String getFirstName() {
	return firstName;
    }

    public void setFirstName(String name) {
	this.firstName = name;
    }

    public String getLastName() {
	return lastName;
    }

    public void setLastName(String name) {
	this.lastName = name;
    }

    public String getUsername() {
	return username;
    }

    public void setUsername(String username) {
	this.username = username;
    }

    public String getMail() {
	return mail;
    }

    public void setMail(String mail) {
	this.mail = mail;
    }

    public String getPassword() {
	return password;
    }

    public void setPassword(String password) {
	this.password = password;
    }

    @Override
    public List<IParticipationChasse> getChasses() {
	return this.participations;
    }

    @Override
    public String toString() {
	return new Gson().toJson(this);
    }
}
